<template>
	<view>
		<!-- 头部背景 -->
		<view class="headCss"></view>

		<!-- 控制面板 -->
		<view class="headText" @click="scanQRcodes()">
			<view class="img">
				<image src="/static/images/二维码.png" mode=""></image>
				<image src="/static/images/扫码 (2).png" mode=""></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		methods: {
			toscanQrcode() {
				uni.navigateTo({
					url: '/pages/verifyItem/scan-qrcode/scan-qrcode'
				});
			},
			scanQRcodes(){
				uni.scanCode({
					success: (res) => {
						if (res.result) {
							console.log('扫描结果：', res.result);
						} else {
							uni.showToast({
								title: '扫描失败',
								icon: 'none'
							});
						}
					},
					fail: (err) => {
						console.log(err);
						if (err.errMsg.includes('cancel')) {
							uni.showToast({
								title: '扫描已取消',
								icon: 'none'
							});
						} else {
							uni.showToast({
								title: '调用相机失败',
								icon: 'none'
							});
						}
					}
				});
			}
		}
	}
</script>

<style scoped>
	.headCss {
		background-color: #3385fd;
		width: 750rpx;
		height: 300rpx;
		position: fixed;
	}

	.headText {
		background-color: #fff;
		border-radius: 20rpx;
		width: 710rpx;
		height: 80vh;
		margin-left: 20rpx;
		position: relative;
	}

	.img {
		position: absolute;
		margin: 200rpx 230rpx;
	}

	.img>image {
		width: 250rpx;
		height: 250rpx;
		position: absolute;
	}
</style>